class Product {
  int? id;
  String name = '';
  String logo = '';
  int loanMax = 0;
  int loanMin = 0;
  String url = '';
  String logoUrl = ''; // API产品的logo
  String loanSpeed = '';
  double interestRate = 0.00; // 利率
  String interestMethod = 'day'; // 利率单位
  String loanCycleMin = ''; // 借款期数
  String loanCycleMax = ''; // 借款期数

  Product(
      {this.id,
        this.name = '',
        this.logo = '',
        this.loanMax = 0,
        this.loanMin = 0,
        this.url = '',
        this.loanSpeed = '',
        this.interestRate = 0.00,
        this.interestMethod = 'day',
        this.loanCycleMin = '',
        this.loanCycleMax = ''});

  Product.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    if(json['name'] != null){
      name = json['name'];
    }
    if(json['logo'] != null){
      logo = json['logo'];
    }
    if(json['loan_max'] != null){
      loanMax = json['loan_max'];
    }
    if(json['loan_min'] != null){
      loanMin = json['loan_min'];
    }
    if(json['url'] != null){
      url = json['url'];
    }
    if(json['logo_url'] != null){
      logoUrl = json['logo_url'];
    }
    if(json['loan_speed'] != null){
      loanSpeed = json['loan_speed'];
    }
    if(json['interest_rate'] != null){
      interestRate = json['interest_rate'];
    }
    if(json['interest_method'] != null){
      interestMethod = json['interest_method'];
    }
    if(json['loan_cycle_min'] != null){
      loanCycleMin = json['loan_cycle_min'];
    }
    if(json['loan_cycle_max'] != null){
      loanCycleMax = json['loan_cycle_max'];
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = this.id;
    data['name'] = this.name;
    data['logo'] = this.logo;
    data['loan_max'] = this.loanMax;
    data['loan_min'] = this.loanMin;
    data['url'] = this.url;
    data['loan_speed'] = this.loanSpeed;
    return data;
  }
}

